// ml:run = $bin < input
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;

struct pa{ int x, y; };

bool operator<(pa const& a, pa const& b)
{
    return a.x < b.x || (a.x == b.x && a.y < b.y);
}

int ans[40010];
int n, m;
map<pa, int > M;

int main()
{
    int t;
    scanf("%d", &t);
    while(t--){
        M.clear();
        memset(ans, 0, sizeof(ans));
        scanf("%d%d", &n, &m);
        for (int i=1;i<=n-1;i++){
            int u, v, x;
            scanf("%d%d%d", &u, &v, &x);
            ans[u] ^= x;
            ans[v] ^= x;
            M[{u, v}]=x;
            M[{v, u}]=x;
        }
        int ty, x, y, z;
        for (int i=0;i<m;i++){
            scanf("%d", &ty);
            if (ty==0){
                scanf("%d", &x);
                printf("%s\n", ans[x]==0?"Boys win!":"Girls win!");
            }
            else{
                scanf("%d%d%d", &x, &y, &z);
                if (M[{x, y}]!=z){
                    M[{x, y}]=z;
                    M[{y, x}]=z;
                    ans[x] ^= 1;
                    ans[y] ^= 1;
                }
            }
        }
    }
}

